package cn.tqfeiyang.smartadmin.business.organization.controller;

import cn.tqfeiyang.smartadmin.business.organization.constant.EmployeeConstants;
import cn.tqfeiyang.smartadmin.business.organization.service.EmployeeCacheService;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import cn.tqfeiyang.smartadmin.commons.response.ApiResult;
import cn.tqfeiyang.smartadmin.commons.logging.OperationLog;

/**
 * 员工缓存控制器
 *
 * @author tqfeiyang
 * @since 2024-10-18
 */
@RestController
@RequestMapping(EmployeeConstants.REQUEST_URL)
@Tag(name = EmployeeConstants.API_TAG)
public class EmployeeCacheController {

    /**
     * 员工缓存服务
     */
    @Resource
    private EmployeeCacheService employeeCacheService;

    /**
     * 清空员工缓存
     */
    @OperationLog
    @PostMapping("/clearEmployeeCache")
    @Operation(summary = "员工 - 清空员工缓存")
    @SaCheckPermission(EmployeeConstants.PERMISSION + "clearEmployeeCache")
    public ApiResult clearEmployeeCache() {
        employeeCacheService.clearCache();
        return ApiResult.success();
    }
}
